package com.chuanye.mydrawable.views;

import android.app.DatePickerDialog;
import android.content.Context;

import java.util.Calendar;

/**
 * Created by yiqiang on 2018/7/5.
 */

public class DateDialog extends DatePickerDialog {

    public DateDialog(Context context, long date, OnDateSetListener callBack) {
        this(context, callBack, 0, 0, 0);
        Calendar calendar = Calendar.getInstance();
        try {
            if (date > 0)
                calendar.setTimeInMillis(date);
        } catch (Exception e) {
            e.printStackTrace();
        }
        onDateChanged(null, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
    }

    public DateDialog(Context context, OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth) {
        super(context, callBack, year, monthOfYear, dayOfMonth);
//        init();;
    }

//    public void init() {
//        getWindow().getAttributes().gravity = Gravity.CENTER;
//    }
}
